From: Tim Starling Date: Thu, 22 Feb 2007 02:12:46 +0000 (+0000) Subject: debugging lost connections X-Git-Tag: 1.31.0-rc.0~53985 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=994743b79ec71947c9648c41336aa1160cf98b54;p=lhc%2Fweb%2Fwiklou.git debugging lost connections --- diff --git a/includes/Database.php b/includes/Database.php index d295580834..d51553f8d2 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -521,7 +521,7 @@ class Database { } if ($this->mConn === false) { $iplus = $i + 1; - wfLogDBError("Connect loop error $iplus of $max ($server): " . mysql_errno() . " - " . mysql_error()."\n"); + #wfLogDBError("Connect loop error $iplus of $max ($server): " . mysql_errno() . " - " . mysql_error()."\n"); } } @@ -662,6 +662,11 @@ class Database { wfDebug( "Connection lost, reconnecting...\n" ); if ( $this->ping() ) { wfDebug( "Reconnected\n" ); + $sqlx = substr( $commentedSql, 0, 500 ); + $sqlx = strtr( $sqlx, "\t\n", ' ' ); + global $wgRequestTime; + $elapsed = round( microtime(true) - $wgRequestTime, 3 ); + wfLogDBError( "Connection lost and reconnected after {$elapsed}s, query: $sqlx\n" ); $ret = $this->doQuery( $commentedSql ); } else { wfDebug( "Failed\n" );